<html>
	<?php
		require_once("classes/User.php");
		require_once("classes/Database.php");
		require_once("classes/Head.php");
		require_once("classes/Section.php");
		require_once("classes/Image.php");
		require_once("classes/Title.php");
		require_once("classes/Paragraph.php");
		require_once("classes/LinkList.php");
		require_once("classes/Form.php");
		
		session_start();
		
		$head = new Head();
		$user = $_SESSION["user"];
		
		if($_SESSION["login"]){
			$title = "Adicionar Experi&ecircncia";
		}else{
			$title = "Login Errado";
		}
		$head->addLayout("css/style.css");
		$head->addTitle($title);
		
		$head->printHead();
	?>
	<body id="body">
		<div id="struture">
			<div id="container">
		        <?php
		        	$header = new Section("header");					
						$header->addElement(new Image("images/job.png", "logo", "100px", "100px"));
						
						$title = new Title("Ofertas de Emprego", "title");
						$header->addElement($title);
					$header->printSection();
		        	
		        	/* Left Page */
		        	$leftPage = new Section("leftPage");
					if(!$_SESSION["login"]){
						$leftPage->addElement(new Title("Erro", "menuTitle"));
						$leftPage->addElement(new Paragraph("Login Errado", "menu"));
					}else{
						$leftPage->addElement(new Title("Ajuda", "menuTitle"));
						$leftPage->addElement(new Paragraph("Introduza os dados de uma experi&ecircncia no formul&aacuterio.", "menu"));
						$leftPage->addElement(new Paragraph("Clique em Gravar para submeter os dados e inserir novos.", "menu"));
						
						if(isset($_SESSION["msg"])){
							$leftPage->addElement(new Paragraph($_SESSION["msg"], "menu"));
							unset($_SESSION["msg"]);
						}
						
						$voltar = new LinkList("menuEntry");
						$voltar->addLink("Voltar", "createCV.php", new Image("images/leave.png", "icon", "16px", "16px"));
						$leftPage->addElement($voltar);
					}
					$leftPage->printSection();

					$content = new Section("content");
					if($_SESSION["login"]){
						$content->addElement(new Title("Inserir Experi&ecircncia", "seccaoTitle"));
						
						$form = new Form("scripts/validateExperiences.php", "POST", "formTable");
						$form->addInput("Empresa:", "text", "enterprise", "input", "", "", TRUE);
						$form->addInput("Actividade:", "text", "activity", "input", "", "", FALSE);
						$form->addInput("Data Inicio:", "date", "startdate", "input", "", "", TRUE);
						$form->addInput("Data Fim:", "date", "enddate", "input", "", "", TRUE);
						$form->addInput("", "submit", "", "button", "Gravar", "", FALSE);
						$content->addElement($form);
					}else{
						$content->addElement(new Title("Erro", "seccaoTitle"));
					}
					
					$content->printSection();
					
					$footer = new Section("footer");
						$text = new Paragraph("Copyright&copy Nuno Pombo", "");
						$footer->addElement($text);
					$footer->printSection();
		        ?>
			</div>
		</div>
	</body>
</html>